﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout_manage.cshtml";
}      

<div class="contentcontainer" id="graphs">
    <div class="headings alt">
        <h2 class="left">独音动态</h2>
        <ul class="smltabs">
            <li><a href="#graphs-1">项目动态</a></li>
            <li><a href="#graphs-2">站点新闻</a></li>
            <li><a href="#graphs-3">我的关注</a></li>
            <li><a href="#graphs-4">我的项目</a></li>
        </ul>
    </div>
    <div class="contentbox" id="graphs-1">
		<table width="100%">
            <thead>
                <tr>
                    <th width="70">标题</th>
                    <th width="10">关注次数</th>
                    <th width="20">编辑时间</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in (IEnumerable<WmWebSystem.Models.News>)ViewData["News"])
                {
                <tr class="alt">
                    <td>
                        <a href="@Url.Action("Details", "News", new { id=item.NewsId})">
                          @Html.DisplayFor(modelItem => item.Title)
                        </a>
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.ClickNum)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.AddTime)
                    </td>
                </tr>
                }
            </tbody>
        </table>
    </div>
    <div class="contentbox" id="graphs-2">
        <table width="100%">
            <thead>
                <tr>
                    <th width="50">项目名称</th>
                    <th width="10">发布者</th>
                    <th width="10">集资金额</th>
                    <th width="10">已筹金额</th>
                    <th width="20">项目进度</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in (IEnumerable<WmWebSystem.Models.Project>)ViewData["newProjects"])
                {
                <tr class="alt">
                    <td>
                        <a href="@Url.Action("Details", "Project", new { id = item.ProjectId })">
                          @Html.DisplayFor(modelItem => item.ProjectName)
                        </a>
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Author)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.TargetValue)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.CurrentValue)
                    </td>
                    <td>
                       @{
                        decimal target= Convert.ToDecimal(item.TargetValue);
                        decimal current = Convert.ToDecimal(item.CurrentValue);

                        string n = (current / target).ToString("0.##%");
                        <div class="midbar" style="width:@n"></div>
                       }
                    </td>
                    <th>项目评论</th>
                    <td>
                       <table>
                        @foreach (var com in (IEnumerable<WmWebSystem.Models.Comment>)ViewData["Comments"])
                        {
                            <tr>
                            if (com.ProjectNo == item.ProjectNo)
                            {
                               <th width="100px">@com.Editor</th>
                               <td>
                                  @com.Content
                               </td>
                            }
                            </tr>
                        }
                       </table>
                   </td>
                    <td>
                        @using (Html.BeginForm("CreateInZone", "Comment", FormMethod.Post, new { enctype = "multipart/form-data" }))
                        {
                            @Html.ValidationSummary(true)
                            @Html.Hidden(item.ProjectNo)
                            @Html.TextArea("CommentMsg", new { @class = "myInput_area_news" })
                            <input type="submit" id="CommentClick" name="CommentClick" value="提交评论" />
                        }
                   </td>
                </tr>
                }
            </tbody>
        </table> 
    </div>
    <div class="contentbox" id="graphs-3">
		<table width="100%">
            <thead>
                <tr>
                    <th width="50">项目名称</th>
                    <th width="10">发布者</th>
                    <th width="10">集资金额</th>
                    <th width="10">已筹金额</th>
                    <th width="20">项目进度</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in (IEnumerable<WmWebSystem.Models.Project>)ViewData["Attentions"])
                {
                <tr class="alt">
                    <td>
                        <a href="@Url.Action("Details", "Project", new { id = item.ProjectId })">
                          @Html.DisplayFor(modelItem => item.ProjectName)
                        </a>
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Author)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.TargetValue)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.CurrentValue)
                    </td>
                    <td>
                       @{
                        decimal target= Convert.ToDecimal(item.TargetValue);
                        decimal current = Convert.ToDecimal(item.CurrentValue);

                        string n = (current / target).ToString("0.##%");
                        <div class="midbar" style="width:@n"></div>
                       }
                    </td>
                    <th>项目评论</th>
                    <td>
                       <table>
                        @foreach (var com in (IEnumerable<WmWebSystem.Models.Comment>)ViewData["Comments"])
                        {
                            <tr>
                            if (com.ProjectNo == item.ProjectNo)
                            {
                               <th width="100px">@com.Editor</th>
                               <td>
                                  @com.Content
                               </td>
                            }
                            </tr>
                        }
                       </table>
                   </td>
                    <td>
                        @using (Html.BeginForm("CreateInZone", "Comment", FormMethod.Post, new { enctype = "multipart/form-data" }))
                        {
                            @Html.ValidationSummary(true)
                            @Html.Hidden(item.ProjectNo)
                            @Html.TextArea("CommentMsg", new { @class = "myInput_area_news" })
                            <input type="submit" id="CommentClick" name="CommentClick" value="提交评论" />
                        }
                   </td>
                </tr>
                }
            </tbody>
        </table> 
    </div>
    <div class="contentbox" id="graphs-4">
		<table width="100%">
            <thead>
                <tr>
                    <th width="50">项目名称</th>
                    <th width="10">发布者</th>
                    <th width="10">集资金额</th>
                    <th width="10">已筹金额</th>
                    <th width="20">项目进度</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in (IEnumerable<WmWebSystem.Models.Project>)ViewData["MyPros"])
                {
                <tr class="alt">
                    <td>
                        <a href="@Url.Action("Details", "Project", new { id = item.ProjectId })">
                          @Html.DisplayFor(modelItem => item.ProjectName)
                        </a>
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Author)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.TargetValue)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.CurrentValue)
                    </td>
                    <td>
                       @{
                        decimal target= Convert.ToDecimal(item.TargetValue);
                        decimal current = Convert.ToDecimal(item.CurrentValue);

                        string n = (current / target).ToString("0.##%");
                        <div class="midbar" style="width:@n"></div>
                       }
                    </td>
                    <th>项目评论</th>
                    <td>
                       <table>
                        @foreach (var com in (IEnumerable<WmWebSystem.Models.Comment>)ViewData["Comments"])
                        {
                            <tr>
                            if (com.ProjectNo == item.ProjectNo)
                            {
                               <th width="100px">@com.Editor</th>
                               <td>
                                  @com.Content
                               </td>
                            }
                            </tr>
                        }
                       </table>
                   </td>
                    <td>
                        @using (Html.BeginForm("CreateInZone", "Comment", FormMethod.Post, new { enctype = "multipart/form-data" }))
                        {
                            @Html.ValidationSummary(true)
                            @Html.Hidden(item.ProjectNo)
                            @Html.TextArea("CommentMsg", new { @class = "myInput_area_news" })
                            <input type="submit" id="CommentClick" name="CommentClick" value="提交评论" />
                        }
                   </td>
                </tr>
                }
            </tbody>
        </table> 
    </div>
</div>

